<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>顺风车  --- 我做主：我的求购信息</title>
<link href="${ctx}/css/myhome-css/home_service_base.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/myhome-css/book-order.css" rel="stylesheet" type="text/css" />

</head>
<body>

    <!--右栏开始-->
    
    <div id="orderList" class="account_right">
      <h2>管理我的求购信息</h2>
      <h3>可以发布、查看、修改、删除我的求购信息</h3>
      <div class="no_dang_m">
        <div class="no_dang_border">
		  <!--下面是右边内容方框-->
          <div class="activ_lq">
          <form action="${ctx}/home/book-order!save.action" method="post" >
          <input type="hidden" name="id" value=""/>
			<div>
              <label>商品名：</label>
              <input id="bookName" class="put_in" maxlength="20" name="bookName" value="" />
              <span id="couponID_warn"></span>
            </div>
            <div>
              <label>详情：</label>
              <input id="isbn" class="put_in" value="" maxlength="20" type="text" name="isbn" />
              <span id="coupon_password_warn"></span>
            </div>
            <div>
              <label>品牌：</label>
              <input id="publisher" class="put_in" value="" maxlength="20" type="text" name="publisher" />
              <span id="coupon_password_warn"></span>
            </div>
            <div>
              <label>数量：</label>
              <input id="count" class="put_in" value="" maxlength="20" type="text" name="count" />
              <span id="coupon_password_warn"></span>
            </div>
            <div class="mode_yzm_cont_e_100x30">
              <p>请输入验证码：</p>
              <input id="vcode_input" name="checkCode" />
              <span id="captchaImg"><img title="验证码" src="${ctx}/jcaptcha.jpg" /></span> 
              <a href="javascript:refreshCaptcha()">换张图</a><span id="vcode_warn"></span> 
            </div>
            <div>
              <input class="butt_acti"  id="submitButton" value="确 定" type="submit" name="input" />
              <input class="butt_acti"  id="resetButton" value="取 消" type="reset" name="input"/>
            </div><br />
            <div style="color:#f00;">	  
            	<s:if test="captchaError !=null">
	  				<p style="margin-left:85px;">验证码错误，请重试.</p>
	  			</s:if>
            </div>
            <div class="lq_note"><span id="tag_box"></span></div>
          </form>
          </div>
          <div class="intro intro_lq">
            <h3 class=tit>求购信息反馈</h3>
            <h3><strong>最近关注本条信息的用户</strong></h3>
            <h3>liang,zcq,zzb</h3>
            <h3><strong>用户留言</strong></h3>
            <h3>liang：我们可以实现免费配货！</h3>
            <h3>zcq：这边价格最优惠！</h3>
            <h3>zzb：可以来我们的店里看看${bookName}</h3>
          </div>
		  <!--右边内容方框结束-->
          <div class="clear"></div>
        <div class="orderList">
      	<ul class="orderListTitle">
        	<li>商品名</li>
            <li>详情</li>
            <li>品牌</li>
            <li>数量</li>
            <li>操作</li>
        </ul>
        <div class="orders">
        <!--
        	<ul>
            	<li>新山地变速车</li>
            	<li>八五新，车况良好，附带两把锁。有意者短信联系15168309242</li>
            	<li>山地车</li>
            	<li>1</li>
            	<li>
                	<a class="orderEdit" href="#">修改</a>&nbsp;
                    <a href="#">删除</a>&nbsp;
                    <a class="view" href="#">查看</a>&nbsp;
                </li>
            </ul>
           -->
           <s:iterator value="page.pageList" status="itStatus">
            <ul>
            	<li><s:property value="bookName" escape="false"/><s:if test="bookName==null">&nbsp;</s:if></li>
            	<li><s:property value="isbn" escape="false"/><s:if test="isbn==null">&nbsp;</s:if></li>
            	<li><s:property value="publisher" escape="false"/><s:if test="publisher==null">&nbsp;</s:if></li>
            	<li><s:property value="count" escape="true"/><s:if test="count==null">0</s:if></li>
            	<li>
                	<a class="orderEdit" href="javascript:edit(${id})">修改</a>&nbsp;
                    <a href="${ctx}/home/book-order!delete.action?id=${id}" onclick="return wenwen();">删除</a>&nbsp;
                    <a class="view" href="#">查看</a>&nbsp;
                </li>
            </ul>
          </s:iterator>
        </div>
        <div class="nextPage">
          <n:page actionUrl="${ctx}/home/book-order.action" sumPages="${page.totalPages}" activePage="${page.currentPage}" pageNoKey="niagara_params_pageNo"/>
      	</div>
      </div>
<script>
function showDetail(e){
	var parent = e.parentNode.parentNode.firstChild;
	//alert(parent.nodeName);
	if(parent.firstChild != null)
		$("#bookName")[0].value=parent.firstChild.nodeValue;
	else
		$("#bookName")[0].value="";
	//alert(parent.nextSibling.firstChild);
	if(parent.nextSibling.firstChild != null)
		$("#isbn")[0].value=parent.nextSibling.firstChild.nodeValue;
	else
		$("#isbn")[0].value="";
	if(parent.nextSibling.nextSibling.firstChild != null)
		$("#publisher")[0].value=parent.nextSibling.nextSibling.firstChild.nodeValue;
	else
		$("#publisher")[0].value="";
	if(parent.nextSibling.nextSibling.nextSibling.firstChild != null){
		$("#count")[0].value = parent.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
	}
	else
		$("#count")[0].value="0";
	}

	$(".view").click(function(){
		showDetail(this);
		$("#submitButton")[0].disabled="disabled";
		$("#resetButton")[0].disabled="disabled";
	});
	$(".orderEdit").click(function(){
		showDetail(this);
		$("#submitButton")[0].disabled="";
		$("#resetButton")[0].disabled="";
		//让页面显示上面部分
		var url = document.URL;
		if(url.lastIndexOf("#") != -1)
			url = url.replace("#","");
		window.location = url + "#";
	});

	function edit(i){
		$("input:hidden")[0].value = i;
		//alert($("input:hidden")[0].value);
	}

	function refreshCaptcha(){
		$('#captchaImg').html('<img src="${ctx}/jcaptcha.jpg?'+Math.round(Math.random()*100000)+'"/>');
	};
	function wenwen(){
		var flag = confirm("您确定要删除吗？");
		if(flag){
			return true;
		}else{
			return false;
		}
	}
</script>
        <div class="clear"></div>
        </div>           
      </div>
      </div>
    <!--右栏结束-->

</body>
</html>